import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProcessRouteVO, ProcessRouteForm, ProcessRouteQuery } from '@/api/base/workmanship/processRoute/types';

/**
 * 查询工艺路线列表
 * @param query
 * @returns {*}
 */

export const listProcessRoute = (query?: ProcessRouteQuery): AxiosPromise<ProcessRouteVO[]> => {
  return request({
    url: '/base/workmanship/processRoute/list',
    method: 'get',
    params: query
  });
};

/**
 * 获取工艺路线列表
 * @param query
 * @returns {*}
 */
export const queryList = (query?: ProcessRouteForm): AxiosPromise<ProcessRouteForm[]> => {
  return request({
    url: '/base/workmanship/processRoute/queryList',
    method: 'get',
    params: query
  });
};

/**
 * 查询工艺路线详细
 * @param id
 */
export const getProcessRoute = (id: string | number): AxiosPromise<ProcessRouteVO> => {
  return request({
    url: '/base/workmanship/processRoute/' + id,
    method: 'get'
  });
};

/**
 * 新增工艺路线
 * @param data
 */
export const addProcessRoute = (data: ProcessRouteForm) => {
  return request({
    url: '/base/workmanship/processRoute',
    method: 'post',
    data: data
  });
};

/**
 * 修改工艺路线
 * @param data
 */
export const updateProcessRoute = (data: ProcessRouteForm) => {
  return request({
    url: '/base/workmanship/processRoute',
    method: 'put',
    data: data
  });
};

/**
 * 删除工艺路线
 * @param id
 */
export const delProcessRoute = (id: string | number | Array<string | number>) => {
  return request({
    url: '/base/workmanship/processRoute/' + id,
    method: 'delete'
  });
};

export default {
  queryList
};
